
import Dialog from '@vant/weapp/dialog/dialog';
import Notify from '@vant/weapp/notify/notify';
Page({
  data: {
    background: ['https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Fc1933e94d7eac6463f3d86772f33788538e60c2c151f1-wz2KHq_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg', 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic.pp3.cn%2Fuploads%2F201704%2F2017050202.jpg&refer=http%3A%2F%2Fpic.pp3.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg',],
    indicatorDots: true,
    vertical: false,
    autoplay: false,
    interval: 2000,
    duration: 500,
    dialogFlag: false,
    adsideData: [
      {
        id: 1,
        name: '后勤服务'
      },
      {
        id: 2,
        name: '恋爱时间'
      },
      {
        id: 3,
        name: '功能卡'
      },
      {
        id: 4,
        name: '自由时间'
      },
      {
        id: 5,
        name: '特殊要求'
      },
      {
        id: 6,
        name: '售后服务'
      },
    ],
    datasource: [
      {
        src: '../imgs/index1.png',
        name: '捏捏肩',
        stock: 500,
        use: 0,
        price: '$1/5分钟'
      },
      {
        src: '../imgs/登录成功.png',
        name: '锤锤腿',
        stock: 500,
        use: 0,
        price: '$1/5分钟'
      },
      {
        src: '../imgs/暂无创建订单.png',
        name: '头部按摩',
        stock: 500,
        use: 0,
        price: '$1/5分钟'
      },
      {
        src: '../imgs/暂无查询订单.png',
        name: '挠背',
        stock: 500,
        use: 0,
        price: '$1/5分钟'
      },
      {
        src: '../imgs/谢谢参与.png',
        name: '擀皮',
        stock: 500,
        use: 0,
        price: '$1/5分钟'
      },
      {
        src: '../imgs/福利每天轻松领.png',
        name: '压榨熬夜(下单前请询问客服)',
        stock: 500,
        use: 0,
        price: '$1/5分钟'
      },
    ],
    // 恋爱时间
    loveTime: [
      {
        src: '../imgs/12个元素_快乐小男孩.png',
        name: '啵啵',
        stock: 520,
        use: 0,
        price: '￥5.2/5分钟'
      },
      {
        src: '../imgs/12个元素_快乐小团子1.png',
        name: '抱抱',
        stock: 520,
        use: 0,
        price: '￥5.2/5分钟'
      },
      {
        src: '../imgs/12个元素_快乐小团子2.png',
        name: '睡觉觉',
        stock: 520,
        use: 0,
        price: '￥5.2/5分钟'
      },
      {
        src: '../imgs/12个元素_快乐小团子3.png',
        name: '牵手手',
        stock: 520,
        use: 0,
        price: '￥5.2/5分钟'
      },
    ],

    // 功能卡
    functionCard: [
      {
        src: '../imgs/白色花.png',
        name: '做主卡',
        stock: 20,
        use: 0,
        price: '￥10'
      },
      {
        src: '../imgs/粉色花.png',
        name: '批准卡',
        stock: 20,
        use: 0,
        price: '￥10'
      },
      {
        src: '../imgs/小花2.png',
        name: '和好卡',
        stock: 20,
        use: 0,
        price: '￥10'
      },
      {
        src: '../imgs/星星花.png',
        name: '万能卡',
        stock: 20,
        use: 0,
        price: '￥10'
      },
      {
        src: '../imgs/郁金香.png',
        name: '煮饭卡',
        stock: 20,
        use: 0,
        price: '￥10'
      },
      {
        src: '../imgs/朱萸图标.png',
        name: '家务卡',
        stock: 20,
        use: 0,
        price: '￥10'
      },
    ],

    // 后勤
    logistics: [
      {
        src: '../imgs/index1.png',
        name: '捏捏肩',
        stock: 500,
        use: 0,
        price: '$1/5分钟'
      },
      {
        src: '../imgs/登录成功.png',
        name: '锤锤腿',
        stock: 500,
        use: 0,
        price: '$1/5分钟'
      },
      {
        src: '../imgs/暂无创建订单.png',
        name: '头部按摩',
        stock: 500,
        use: 0,
        price: '$1/5分钟'
      },
      {
        src: '../imgs/暂无查询订单.png',
        name: '挠背',
        stock: 500,
        use: 0,
        price: '$1/5分钟'
      },
      {
        src: '../imgs/谢谢参与.png',
        name: '擀皮',
        stock: 500,
        use: 0,
        price: '$1/5分钟'
      },
      {
        src: '../imgs/福利每天轻松领.png',
        name: '压榨熬夜(下单前请询问客服)',
        stock: 500,
        use: 0,
        price: '$1/5分钟'
      },
    ],

    // 自由时间
    freeTime: [
      {
        src: '../imgs/狗.png',
        name: '无忧看剧',
        stock: 520,
        use: 0,
        price: '￥5'
      },
      {
        src: '../imgs/猫咪.png',
        name: '无忧抖音',
        stock: 520,
        use: 0,
        price: '￥5'
      },
      {
        src: '../imgs/12个元素_半个甜甜圈.png',
        name: '陪逛街',
        stock: 520,
        use: 0,
        price: '￥5'
      },
      {
        src: '../imgs/12个元素_墨镜男孩.png',
        name: '陪看电影',
        stock: 520,
        use: 0,
        price: '￥5'
      },
      {
        src: '../imgs/12个元素_红包餐桌布.png',
        name: '陪饭',
        stock: 520,
        use: 0,
        price: '￥5'
      },
    ],

    // 特殊要求
    specialRequirements: [
      {
        src: '../imgs/福袋.png',
        name: '换个女朋友',
        stock: 1,
        use: 0,
        price: '￥999999'
      },
    ],
    // 售后服务
    AftersalesService: [
      {
        src: '../imgs/拿红包.png',
        name: '投诉与建议',
        stock: 1,
        use: 0,
        price: '￥99'
      },
      {
        src: '../imgs/抽签.png',
        name: '本店最终解释权归summer所有',
        stock: 1,
        use: 0,
        price: '￥99'
      },
    ],
    
  },

  // 添加
  add: function() {
    Dialog.alert({
      title: '标题',
      message: '弹窗内容',
    }).then(() => {
      // on close
    });
    this.setData({dialogFlag:!this.data.dialogFlag})
  },
  // 确认添加
  confirms: function() {
    console.log(121);
    Notify({ type: 'success', message: '下单成功，支持当面转账' });
  },

  changeIndicatorDots() {
    this.setData({
      indicatorDots: !this.data.indicatorDots
    })
  },
  changeActiveId(value) {
    console.log('我是拿到选择的值', value.detail)
    switch (value.detail) {
      case 0:
        this.setData({ datasource: this.data.logistics })
        break;
      case 1:
        this.setData({ datasource: this.data.loveTime })
        break;
      case 2:
        this.setData({ datasource: this.data.functionCard })
        break;
      case 3:
        this.setData({ datasource: this.data.freeTime })
        break;
      case 4:
        this.setData({ datasource: this.data.specialRequirements })
        break;
      case 5:
        this.setData({ datasource: this.data.AftersalesService })
        break;
      default:
        break;
    }
  },

  changeAutoplay() {
    this.setData({
      autoplay: !this.data.autoplay
    })
  },

  intervalChange(e) {
    this.setData({
      interval: e.detail.value
    })
  },

  durationChange(e) {
    this.setData({
      duration: e.detail.value
    })
  }
})